ActionController::Routing::Routes.draw do |map|
  map.root :controller => "user_sessions", :action => "new"

  #menu routes
  map.logout 'logout', :controller => 'user_session', :action => 'destroy'
  #educational_plans
  map.resources :educational_levels, :as => 'levels', :path_prefix => '/educational_plans', :id => /\d{1,}/
  map.resources :academic_degrees, :as => 'degrees', :path_prefix => '/educational_plans', :id => /\d{1,}/
  map.resources :grades, :path_prefix => '/educational_plans', :id => /\d{1,}/
  map.resources :subjects, :path_prefix => '/educational_plans', :id => /\d{1,}/
  map.add_subject_to_plan '/educational_plans/add_subject/:plan_id', :controller => 'subjects', :action => 'add_to_plan', :plan_id => /\d{1,}/
  map.plan_subjects '/educational_plan/:plan_id/list_subjects', :controller => 'subjects', :action => 'list', :plan_id => /\d{1,}/
  map.resources :educational_plans, :id => /\d{1,}/

  #schedules
  map.resources :terms, :path_prefix => '/schedules', :id => /\d{1,}/
  map.resources :time_units, :path_prefix => '/schedules', :id => /\d{1,}/
  map.resources :intervals, :path_prefix => '/schedules', :id => /\d{1,}/
  map.resources :schedules, :id => /\d{1,}/

  #calendars
  map.resources :procedures, :path_prefix => '/calendars', :id => /\d{1,}/
  map.resources :calendar_types, :as => 'types', :path_prefix => '/calendars', :id => /\d{1,}/
  map.resources :procedures, :path_prefix => '/calendars', :id => /\d{1,}/
  map.resources :calendars, :id => /\d{1,}/

  #users
  map.resource :account, :controller => "users"
  map.resources :roles, :path_prefix => '/users', :id => /\d{1,}/
  map.resources :permissions, :path_prefix => '/users', :id => /\d{1,}/
  map.resources :users, :id => /\d{1,}/
  map.resources :password_resets
  map.resource :user_session

  #students
  map.resources :student_enrollments, :as => 'enrollments', :path_prefix => '/students', :id => /\d{1,}/
  map.resources :student_plan_enrollments, :as => 'plan_enrollments', :path_prefix => '/students', :id => /\d{1,}/
  map.resources :students, :id => /\d{1,}/, :has_one => [:person]

  #teachers
  map.resources :teachers, :id => /\d{1,}/, :has_one => [:person]
  
  map.resources :user_permissions,
    :user_people, :equivalent_time_units, :equivalent_grades,
    :system_configurations, :system_modules, :calendar_procedures, 
     :group_grade_certificates, :group_teacher_schedules, :group_teachers,
    :group_space_schedules, :group_spaces, :group_schedules, :temporal_discharges,
    :definite_discharges, :groups, :academic_terms,
    :group_types, :enrollment_types, :system_operators, :contact_fields,
    :people, :evaluation_types,
    :services, :academic_spaces, :academic_space_types,
    :buildings
end
